package com.bjwl.service.safty.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bjwl.base.PageParams;
import com.bjwl.dao.safty.UserDao;
import com.bjwl.model.Role;
import com.bjwl.model.User;
import com.bjwl.service.safty.UserService;
import com.bjwl.view.UserQueryView;
import com.bjwl.view.UserUpdatePwdView;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
public class UserServiceImpl implements UserService{

	@Autowired
	private UserDao userDao;
	@Override
	public PageInfo<UserQueryView> queryUser(PageParams pageParams) {
		PageHelper.startPage(pageParams);
		List<UserQueryView> users=userDao.queryUser();
		//创建PageInfo对象，将list集合放进去
		PageInfo<UserQueryView> pageInfo=new PageInfo<>(users);
		return pageInfo;
	}

	@Override
	public boolean addUser(User user) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean editUser(User user) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean enableUser(String u_id) {
		Integer flag=userDao.enableUser(u_id);
		if(flag>0) {
			return true;
		}
		return false;
	}

	@Override
	public boolean disableUser(String u_id) {
		Integer flag=userDao.disableUser(u_id);
		if(flag>0) {
			return true;
		}
		return false;
	}

	@Override
	public boolean updatePwdByUid(UserUpdatePwdView userUpdatePwdView) {
		// TODO Auto-generated method stub
		return false;
	}

}
